package com.heitian.ssm.service.impl;

import com.heitian.ssm.dao.MessageEntityMapper;
import com.heitian.ssm.model.MessageEntity;
import com.heitian.ssm.service.MessageService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: mishuai
 * Date: 2018-04-26
 * Time: 00:43
 * Des:
 */
@Service("messageService")
@Transactional(rollbackFor = Exception.class)
public class MessageServiceImpl implements MessageService {
    @Resource
    private MessageEntityMapper messageEntityMapper;
    public int insertComment(MessageEntity messageEntity) {
        return messageEntityMapper.insertSelective(messageEntity);
    }

    public List<MessageEntity> selectByCreatTime() {
        return messageEntityMapper.selectByCreatTime();
    }

    public MessageEntity selectById(Long id) {
        return messageEntityMapper.selectByPrimaryKey(id);
    }
}
